import request from '@/utils/request';
import { stringify } from 'qs';
import { paramsToFormData } from '@/utils/utils'

export async function query() {
  return request('/api/users');
}

export async function queryCurrent() {
  return request('/api/currentUser');
}

export async function queryNotices() {
  return request('/api/notices');
}

export async function getUserInfo() {
  return request( `/api/user/getUserInfo`,{
    method: 'GET',
  });
}

export async function getUserList() {
  return request( `/api/user/getUserList`,{
    method: 'GET',
  });
}

export async function getTeacherList() {
  return request( `/api/user/getTeacherList`,{
    method: 'GET',
  });
}




export async function userPrefileUpload(params) {
  return request( `/api/user/userPrefileUpload`,{
    method: 'POST',
    body: paramsToFormData(params),
  });
}

export async function logout() {
  return request( `/api/user/logout`,{
    method: 'POST',
  });
}

export async function registerValid(params) {
  return request( `/api/user/registerValid`,{
    method: 'POST',
    body: paramsToFormData(params),
  });
}

export async function register(params) {
  return request( `/api/user/register`,{
    method: 'POST',
    body: paramsToFormData(params),
  });
}

export async function setUserInfo(params) {
  return request( `/api/user/setUserInfo`,{
    method: 'POST',
    body: paramsToFormData(params),
  });
}

export async function setNewPassword(params) {
  return request( `/api/user/setNewPassword`,{
    method: 'POST',
    body: paramsToFormData(params),
  });
}

export async function setNewRole(params) {
  return request( `/api/user/setNewRole`,{
    method: 'POST',
    body: paramsToFormData(params),
  });
}

export async function setUserStatus(params) {
  return request( `/api/user/setUserStatus`,{
    method: 'POST',
    body: paramsToFormData(params),
  });
}



